const express = require('express')
// 中间件
const auth = require('../../middleware/auth')
const timeAuth = require('../../middleware/time-handler')
const appCtrl = require('../../controller/app')
const router = express.Router()

router.post('/app/addApp', timeAuth, auth, appCtrl.addApp)

router.post('/app/update', timeAuth, auth, appCtrl.updateApp)
router.post('/app/user/backupAppData', timeAuth, auth, appCtrl.backupUserAppData)
router.post('/app/user/backupData', timeAuth, auth, appCtrl.backupUserData)

router.get('/app/user/getBackupData', timeAuth, auth, appCtrl.getUserbackupData)
router.get('/app/getDataByTag', timeAuth, auth, appCtrl.getDataByTag)
router.get('/app/searchData', timeAuth, auth, appCtrl.searchData)
router.get('/app/getData', timeAuth, auth, appCtrl.getData)
router.get('/app/getAppTags', timeAuth, auth, appCtrl.getAppTags)
router.get('/app/getDataByPage', timeAuth, auth, appCtrl.getDataByPage)

router.get('/app/icon/:name', appCtrl.previewIcon)

module.exports = router;